package com.cci.kangdao.dao;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;
import java.util.Map;


@MapperScan
public interface SMNTDao {


    @Select("<script>select * from SMN_T where ID in  <foreach collection='smnId' item='item' open='(' separator=',' close=')'>\n" +
            "            #{item}\n" +
            "        </foreach> and Flag = 0</script>")
    List<Map<String, Object>> getSMNListByIds(@Param("smnId") List<String> smnId);


    @Select("select b.ID as SMNId,b.SMNname as SMN,b.EmissionStandard as standard from UserSMNCollectRelationShip_T a \n" +
            "inner join SMN_T b on a.SMNId = b.ID\n" +
            "where a.Flag = 0 and b.Flag = 0 and a.UserId = #{userId}\n" +
            "order by a.CreateTime desc,b.SMNname collate Chinese_PRC_CS_AS_KS_WS")
    List<Map<String, Object>> getUserCollectSMNListByUserId(@Param("userId") long userId);

    @Select({"<script>" +
            "select ID, SMNname, EngineTypeID, Displacement, EcmName, VariableModel, EmissionStandard, TechnologyMap, Remark, Flag, IsSupportCDS, IsSupportQSOL, IsSupportWOGoToDR, ESN, Manufacturer, IsLocalization from SMN_T where  Flag = 0" +
            " <if test='SMN!=null and SMN !=\"\" '>" +
            " AND  SMNname like concat('%',#{SMN},'%') " +
            " </if>" +
            "</script>"
    })
    List<Map<String, Object>> getSMNList(@Param("SMN") String SMN);

    //DInt,TypeName DValue
    @Select({"<script>" +
            "select SMNname DInt, SMNname  DValue from SMN_T where  Flag = 0" +
            " <if test='SMN!=null and SMN !=\"\" '>" +
            " AND  SMNname like concat('%',#{SMN},'%') " +
            " </if>" +
            "</script>"
    })
    List<Map<String, Object>> getDintDvalueSMNList(@Param("SMN") String SMN);
}
